package umn

import groovyx.net.http.HTTPBuilder
import groovyx.net.http.ContentType

/**
 * Created by IntelliJ IDEA.
 * User: Chris Seeling
 * Date: 3/8/12
 * Time: 2:22 PM
 * To change this template use File | Settings | File Templates.
 */
class monopolyclient {
    public static void main(String[] args) {
        try {
            def http = new HTTPBuilder('http://127.0.0.1:8080')
            def html = http.get(path:'/MonopolyBankService/player',
                    contentType : ContentType.TEXT,
            ) {resp, reader ->
                println "response status: ${resp.statusLine}"
                println "Headers: --------"
                resp.headers.each {h ->
                    println " ${h.name} : ${h.value}"
                }
                println 'Response data: ----'
                System.out << reader
                println '\n-------------------------'
            }
        }
        catch(ex){
            println "HTTP response: " + ex.response.status
            println ex.message
            println ex.stackTrace
        }
    }
}
